<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>应用层数据传输过程</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        
        .section-title {
            position: relative;
            padding-left: 20px;
        }
        
        .section-title::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 30px;
            background: linear-gradient(to bottom, #667eea, #764ba2);
            border-radius: 2px;
        }
        
        .step-number {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 18px;
            flex-shrink: 0;
        }
        
        .content-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 16px;
            padding: 30px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.08);
        }
        
        .highlight-text {
            background: linear-gradient(to right, #667eea, #764ba2);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-weight: 600;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 40px 0;
        }
        
        .icon-box {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 24px;
            margin-bottom: 20px;
        }
        
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <div class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto text-center animate-fadeInUp">
                <h1 class="text-5xl font-bold mb-6">应用层数据传输过程</h1>
                <p class="text-xl opacity-90 leading-relaxed">
                    深入探索数据如何通过OSI模型的各层，从源计算机的应用层开始，经过层层处理与封装，最终到达目标计算机的应用层
                </p>
                <div class="mt-10 flex justify-center space-x-8">
                    <div class="text-center">
                        <i class="fas fa-layer-group text-4xl mb-2"></i>
                        <p class="text-sm">7层协议栈</p>
                    </div>
                    <div class="text-center">
                        <i class="fas fa-exchange-alt text-4xl mb-2"></i>
                        <p class="text-sm">双向传输</p>
                    </div>
                    <div class="text-center">
                        <i class="fas fa-shield-alt text-4xl mb-2"></i>
                        <p class="text-sm">可靠传输</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Main Content -->
    <div class="container mx-auto px-6 py-12">
        <!-- Introduction -->
        <div class="content-card mb-8 animate-fadeInUp">
            <p class="text-lg leading-relaxed text-gray-700">
                应用层的数据传输过程是通过OSI模型的各层（或TCP/IP模型的对应层）逐层传递和处理数据的。这个过程涉及从源计算机的应用层开始，经过各层处理，然后通过网络传输，到达目标计算机的应用层。
            </p>
        </div>

        <!-- Data Flow Visualization -->
        <div class="content-card mb-12">
            <h2 class="text-2xl font-bold mb-6 text-center">数据传输流程图</h2>
            <div class="mermaid">
                graph TB
                    A[应用层<br/>HTTP/SMTP/FTP] -->|封装| B[传输层<br/>TCP/UDP]
                    B -->|分段| C[网络层<br/>IP协议]
                    C -->|路由| D[数据链路层<br/>以太网]
                    D -->|帧封装| E[物理层<br/>比特流]
                    E -->|传输介质| F[物理层<br/>接收端]
                    F -->|解封装| G[数据链路层<br/>接收端]
                    G -->|解帧| H[网络层<br/>接收端]
                    H -->|解包| I[传输层<br/>接收端]
                    I -->|重组| J[应用层<br/>接收端]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:2px,color:#fff
                    style J fill:#764ba2,stroke:#fff,stroke-width:2px,color:#fff
                    style E fill:#48bb78,stroke:#fff,stroke-width:2px,color:#fff
                    style F fill:#48bb78,stroke:#fff,stroke-width:2px,color:#fff
            </div>
        </div>

        <!-- Layer Details -->
        <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
            <!-- 1. 应用层 -->
            <div class="card-hover content-card">
                <div class="flex items-start">
                    <div class="step-number">1</div>
                    <div class="ml-6 flex-1">
                        <h3 class="section-title text-2xl font-bold mb-4">应用层的准备与封装</h3>
                        <p class="text-gray-700 mb-4">
                            在源计算机的应用层，应用程序（如Web浏览器、邮件客户端等）根据特定的应用层协议（如HTTP、SMTP、FTP等）生成数据。
                        </p>
                        <div class="space-y-3">
                            <div class="flex items-start">
                                <i class="fas fa-check-circle text-purple-600 mt-1 mr-3"></i>
                                <div>
                                    <strong class="text-gray-800">生成应用层数据：</strong>
                                    <span class="text-gray-600">应用程序产生数据（如HTTP请求、邮件内容等）</span>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <i class="fas fa-check-circle text-purple-600 mt-1 mr-3"></i>
                                <div>
                                    <strong class="text-gray-800">封装数据：</strong>
                                    <span class="text-gray-600">数据被封装成适合传输的格式，添加应用层头部信息</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 2. 传输层 -->
            <div class="card-hover content-card">
                <div class="flex items-start">
                    <div class="step-number">2</div>
                    <div class="ml-6 flex-1">
                        <h3 class="section-title text-2xl font-bold mb-4">传输层的封装与分段</h3>
                        <p class="text-gray-700 mb-4">
                            应用层数据被传递给传输层。在TCP/IP模型中，传输层主要使用TCP或UDP进行处理。
                        </p>
                        
                        <div class="bg-purple-50 rounded-lg p-4 mb-4">
                            <h4 class="font-bold text-purple-800 mb-2"><i class="fas fa-network-wired mr-2"></i>TCP（传输控制协议）</h4>
                            <ul class="space-y-2 text-sm text-gray-700">
                                <li><i class="fas fa-handshake text-purple-600 mr-2"></i>建立连接：三次握手建立可靠连接</li>
                                <li><i class="fas fa-cut text-purple-600 mr-2"></i>分段：将大数据分成多个小段</li>
                                <li><i class="fas fa-plus-circle text-purple-600 mr-2"></i>添加头部：包含端口号、序列号等</li>
                                <li><i class="fas fa-redo text-purple-600 mr-2"></i>错误检测：支持重传和流量控制</li>
                            </ul>
                        </div>
                        
                        <div class="bg-blue-50 rounded-lg p-4">
                            <h4 class="font-bold text-blue-800 mb-2"><i class="fas fa-paper-plane mr-2"></i>UDP（用户数据报协议）</h4>
                            <ul class="space-y-2 text-sm text-gray-700">
                                <li><i class="fas fa-bolt text-blue-600 mr-2"></i>无连接传输：直接发送数据</li>
                                <li><i class="fas fa-box text-blue-600 mr-2"></i>封装数据：生成UDP数据报</li>
                                <li><i class="fas fa-tachometer-alt text-blue-600 mr-2"></i>低延迟：适用于实时应用</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 3. 网络层 -->
            <div class="card-hover content-card">
                <div class="flex items-start">
                    <div class="step-number">3</div>
                    <div class="ml-6 flex-1">
                        <h3 class="section-title text-2xl font-bold mb-4">网络层的路由与转发</h3>
                        <p class="text-gray-700 mb-4">
                            传输层的数据包被传递到网络层。网络层负责数据在不同网络之间的路由选择和转发。
                        </p>
                        <div class="icon-box">
                            <i class="fas fa-route"></i>
                        </div>
                        <div class="space-y-3">
                            <div>
                                <strong class="text-gray-800">数据包封装：</strong>
                                <p class="text-gray-600 mt-1">传输层数据包被封装为IP数据包，添加源IP地址、目标IP地址、TTL等信息</p>
                            </div>
                            <div>
                                <strong class="text-gray-800">路由选择：</strong>
                                <p class="text-gray-600 mt-1">根据目标IP地址选择最优路径，通过路由器逐步转发至目标主机</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 4. 数据链路层 -->
            <div class="card-hover content-card">
                <div class="flex items-start">
                    <div class="step-number">4</div>
                    <div class="ml-6 flex-1">
                        <h3 class="section-title text-2xl font-bold mb-4">数据链路层的帧封装与传输</h3>
                        <p class="text-gray-700 mb-4">
                            网络层的IP数据包被传递到数据链路层，负责在同一网络段内的数据传输。
                        </p>
                        <div class="bg-gradient-to-r from-purple-100 to-blue-100 rounded-lg p-4">
                            <div class="grid grid-cols-3 gap-4 text-center">
                                <div>
                                    <i class="fas fa-ethernet text-3xl text-purple-600 mb-2"></i>
                                    <p class="text-sm font-semibold">帧封装</p>
                                    <p class="text-xs text-gray-600">添加MAC地址</p>
                                </div>
                                <div>
                                    <i class="fas fa-shield-alt text-3xl text-blue-600 mb-2"></i>
                                    <p class="text-sm font-semibold">错误检测</p>
                                    <p class="text-xs text-gray-600">CRC校验</p>
                                </div>
                                